#include "bit_vector.h"
#include <cassert>

#define N 10000000

int main(int argc, char *argv[])
{
  FILE* in_file = fopen("data.txt", "r");
  bit_vector bv(N);
  
  int x;
  while (!feof(in_file)) {
    fscanf(in_file, "%d\n", &x);
    bv.put(x);
  }
  fclose(in_file);

  FILE * out_file = fopen("sorted_data.txt", "w");
  for (int i=0; i<N; ++i) {
    if (bv.get(i) != 0) {
      fprintf(out_file, "%08d\n", i);
    }
  }
  fclose(out_file);

  return 0;
}
